package com.rdkl.printing.service.system;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageInfo;
import com.rdkl.printing.dao.system.${entity}Dao;
import com.rdkl.printing.model.${entity};
import com.rdkl.printing.utils.ParamsUtil;

@Service
@Transactional
public class ${entity}Service {

    @Autowired
    private ${entity}Dao ${entity?uncap_first}Dao;

   /**
     * ${table.comment}分页列表信息
     * @author ${author}
     * @date ${date}
     */
    @Transactional(readOnly = true)
    public PageInfo<${entity}DTO> getPage${entity}(Map<String, Object> paramMap) {
        ParamsUtil.resolvePageParams(paramMap);
        List<${entity}DTO> list = ${entity?uncap_first}Dao.getPage${entity}(paramMap);
        return new PageInfo<>(list);
    }

    /**
     * 插入${table.comment}信息
     * @author ${author}
     * @date ${date}
     */
    public void insert${entity}(${entity} ${entity?uncap_first}) {
        ${entity?uncap_first}Dao.insert${entity}(${entity?uncap_first});
    }

    /**
     * 更新${table.comment}信息
     * @author ${author}
     * @date ${date}
     */
    public void update${entity}(${entity} ${entity?uncap_first}) {
        ${entity?uncap_first}Dao.update${entity}(${entity?uncap_first});
    }

    /**
     * 按id查询${table.comment}信息
     * @author ${author}
     * @date ${date}
     */
    @Transactional(readOnly = true)
    public ${entity} get${entity}ById(Integer ${entity?uncap_first}Id) {
        return ${entity?uncap_first}Dao.get${entity}ById(${entity?uncap_first}Id);
    }

    /**
     * 按ids删除
     *
     * @param ids
     * @return void
     * @Author ${author}
     * @Date ${date}
     */
    public void delete${entity}ByIds(List<Integer> ids) {
        ${entity?uncap_first}Dao.delete${entity}ByIds(ids);
    }

 }
